﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PMS.ENT;
using PMS.DAL;

namespace PMS.BLL
{
    public class DepartmentBLL
    {
        #region Get
        public static DepartmentENT GetDepartmentByID(int projectID)
        {
            try
            {
                return DepartmentDAL.GetDepartmentByID(projectID);
            }
            catch (Exception)
            {
                throw;
            }
        }

        public static DepartmentCollection GetDepartmentList(string DepartmentName,string orderBy, string orderDirection, int page, int pageSize, out int totalRecords)
        {
            try
            {
                return DepartmentDAL.GetDepartmentList(DepartmentName,orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (Exception)
            {
                throw;
            }
        }

        public static DepartmentCollection GetDepartmentListForCMB()
        {
            try
            {
                DepartmentCollection listDepartment = new DepartmentCollection();
                listDepartment.Add(new DepartmentENT { DepartmentID = 0, DepartmentName = "--All--" });
                listDepartment.AddRange(DepartmentDAL.GetDepartmentListForCMB());
                return listDepartment;
            }
            catch (Exception)
            {

                throw;
            }
        }
        #endregion

        #region Insert Update Delete Department


        public static int InsertDepartment(DepartmentENT Department)
        {
            try
            {
                return DepartmentDAL.InsertDepartment(Department);
            }
            catch (Exception)
            {

                throw;
            }
        }


        public static int UpdateDepartment(DepartmentENT DepartmentID)
        {
            try
            {
                return DepartmentDAL.UpdateDepartment(DepartmentID);
            }
            catch (Exception)
            {

                throw;
            }
        }

        public static int DeleteDepartment(int DepartmentID, int UserID)
        {
            try
            {
                return DepartmentDAL.DeleteDepartment(DepartmentID, UserID);
            }
            catch (Exception)
            {

                throw;
            }
        }




        #endregion
    }
}
